/*
 * Created by JFormDesigner on Fri May 27 15:05:24 CST 2022
 */

package jw3.c2.view;

import java.awt.event.*;

import jw3.c2.controller.AdministratorController;
import jw3.c2.controller.RoomsController;
import jw3.c2.controller.Rooms_typeController;
import jw3.c2.controller.VipController;
import jw3.c2.model.Administrator;
import jw3.c2.model.Rooms_type;
import jw3.c2.model.Vip;
import jw3.c2.utils.DBConnection;

import java.awt.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Vector;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;

/**
 * @author Brainrain
 */
public class index2 extends JFrame {
    public index2() {
        initComponents();
        this.setVisible(true);
        this.setTitle("系统设置");
        this.setSize(1200,1000);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.textField5.setVisible(false);
        this.table2.setVisible(false);
        this.textField6.setVisible(false);
        this.label1.setVisible(false);
        this.comboBox1.setVisible(false);
        this.textField1.setVisible(false);
        this.scrollPane2.setVisible(false);
        this.table2.setVisible(false);
        this.scrollPane1.setVisible(false);
        this.table1.setVisible(false);
        this.button4.setVisible(false);
        this.scrollPane3.setVisible(false);
        this.table3.setVisible(false);
        this.scrollPane1.setVisible(false);
        this.table1.setVisible(false);
        this.button5.setVisible(false);
        this.button8.setVisible(false);
        this.comboBox2.setVisible(false);
        this.label4.setVisible(false);
        this.textField9.setVisible(false);
        this.panel2.setVisible(false);
        this.panel5.setVisible(false);
        this.button9.setVisible(false);
        this.button12.setVisible(false);
        this.button13.setVisible(false);
        comboBox1.addItem("可供状态");
        comboBox2.addItem("全部房间信息");





    }

    private void showdata(){
        Vector<Object> heads=new Vector<Object>();
                heads.add("房间类型编号");
                heads.add("房间类型");
                heads.add("房间价格");
                heads.add("房间图片");
                heads.add("房间等级ID");
                heads.add("房间简介");

                //表数据
                data= Rooms_typeController.getAll();

                //3、将表头和数据赋值给模型，表格模型构造完成
                DefaultTableModel dtm=new DefaultTableModel(data,heads);
                table1.setModel(dtm);


                //第二张表
       Vector<Object> heads2=new Vector<Object>();
        heads2.add("房间类型编号");
        heads2.add("房间编号");
        heads2.add("房间类型ID");
        heads2.add("房间状态");
        heads2.add("所在区域");
        heads2.add("房间电话");
        heads2.add("离店状态");

        //表数据
        Vector<Vector<Object>> data2 = RoomsController.getAll();
     //3、将表头和数据赋值给模型，表格模型构造完成
    DefaultTableModel dtm2=new DefaultTableModel(data2,heads2);
 table2.setModel(dtm2);
    }
            //添加房间类型
    private void button5MouseClicked(MouseEvent e) {
        // TODO add your code here
        dialog1.setModal(true); //模态框
        dialog1.setVisible(true);//显示出来



    }
            //添加房间的确认按钮
    private void button6MouseClicked(MouseEvent e) {
        // TODO add your code here



        // 获取数据
        Rooms_type rooms_type = new Rooms_type();

        rooms_type.setRoom_Type(textField2.getText());


        //记得改成 bigdecimal
        rooms_type.setRoom_Price((double) textField3.getScrollOffset());
        rooms_type.setRoom_Img(textField8.getText());
        rooms_type.setR_D(Integer.parseInt(textField10.getText()));
        rooms_type.setR_S(textField11.getText());

        // 判断

        if (!rooms_type.getRoom_Type().equals("") && !rooms_type.getRoom_Price().equals("")) {
            //唯一键重复
            data = Rooms_typeController.getAll();

            for (Vector<Object> item : data) {
                if (item.contains(rooms_type.getRoom_Type())) {
                    showdata();
                    JOptionPane.showMessageDialog(null,
                            "该房间类型已存在!");
                    return;
                }
            }
            if (Rooms_typeController.register(rooms_type)) {

                JOptionPane.showMessageDialog(null,
                        "添加成功!");
                dialog1.dispose();//关闭对话框
            } else {
                JOptionPane.showMessageDialog(null,
                        "添加失败!");
            }
        } else {
            JOptionPane.showMessageDialog(null,
                    "房间或价格不能为空!");
        }
    }
                //客户类型设置
    private void button2MouseClicked(MouseEvent e) {
        // TODO add your code here
        this.label1.setVisible(false);
        this.comboBox1.setVisible(false);
        this.textField1.setVisible(false);
        this.scrollPane1.setVisible(false);
        this.panel2.setVisible(false);
        this.scrollPane2.setVisible(true);
        this.table2.setVisible(true);
        this.button5.setVisible(false);
        this.button4.setVisible(true);
        this.label4.setVisible(false);
        this.comboBox2.setVisible(false);
        this.textField5.setVisible(true);
        this.textField6.setVisible(true);
        this.textField9.setVisible(false);
        this.scrollPane4.setVisible(false);
        this.scrollPane3.setVisible(true);
        this.table3.setVisible(true);
        this.button9.setVisible(false);
        this.button12.setVisible(false);
        this.button8.setVisible(false);
        this.button13.setVisible(false);




        this.panel5.setVisible(false);
        this.scrollPane4.setVisible(false);
        this.table4.setVisible(false);
        this.textField9.setVisible(false);

//        VipController v=new VipController();


        Vector<Object> heads3=new Vector<Object>();
       heads3.add("VIP_ID");
       heads3.add("VIP类型");
       heads3.add("VIP折扣");

      //表数据
       data3= VipController.getAll();

       //3、将表头和数据赋值给模型，表格模型构造完成
      DefaultTableModel dtm3=new DefaultTableModel(data3,heads3);
      table3.setModel(dtm3);






    }
            //房间设置按钮
    private void button1MouseClicked(MouseEvent e) {
        // TODO add your code here
        this.label1.setVisible(true);
        this.comboBox1.setVisible(true);
        this.textField1.setVisible(true);
        this.button4.setVisible(false);
        this.scrollPane1.setVisible(true);
        this.table1.setVisible(true);
        this.button5.setVisible(true);
        this.button8.setVisible(true);
        this.scrollPane2.setVisible(true);
        this.table2.setVisible(true);
        this.textField6.setVisible(true);
        this.button9.setVisible(false);
        this.button12.setVisible(false);
        this.comboBox2.setVisible(true);
        this.button13.setVisible(true);

    }
<<<<<<< HEAD
                    // 客户修改折扣确认
=======
<<<<<<< HEAD
=======
                    //客户类型设置 修改类型
>>>>>>> c99b46d54f58d393ceec8deeb74a45150477d89f
    private void button7MouseClicked(MouseEvent e) {
        // TODO add your code here
//1、获取数据
        Vip ui=new Vip();

        ui.setVip_ID(Integer.parseInt(label13.getText()));
        ui.setVip_Type(textField15.getText());
        ui.setVip_DisCount(Double.valueOf(textField7.getText()));


        //2、简单判断
        if (!ui.getVip_Type().equals("") && !ui.getVip_DisCount().equals("")){
            //唯一键重复
            for (Vector<Object> item:data3){
                if(item.contains(ui.getVip_DisCount())){
                    JOptionPane.showMessageDialog(null,
                            "该折扣已存在!");
                    return;
                }
            }
            if (VipController.edit(ui)){
               showdata();//自动刷新
                JOptionPane.showMessageDialog(null,
                        "更新成功!");
                dialog2.dispose();//关闭对话框
            }else{
                JOptionPane.showMessageDialog(null,
                        "更新失败!");
            }
        }else{
            JOptionPane.showMessageDialog(null,
                    "会员类型或折扣不能为空!");
        }
    }






            //房间类型删除
    private void button8MouseClicked(MouseEvent e) {
        // TODO add your code here

        int index=table1.getSelectedRow();//获取选择第一行的所索引
        if (index!=-1){//是否选中了一行
            if (JOptionPane.showConfirmDialog(null,
                    "您是否确认删除此数据?")==0){//是否点击了确定
                //取id   data、index  data是二维集合，第一个get获取了行、第二个get获取了列
                String sql="delete from rooms_type where Rooms_Type_ID=?";
                int id= (int) data.get(index).get(0);
                Connection conn=null;
                PreparedStatement ps=null;
                try {
                    conn=DBConnection.getConnection();
                    ps=conn.prepareStatement(sql);
                    ps.setInt(1,id);
                    if (ps.executeUpdate()>0){
                        showdata();
                        JOptionPane.showMessageDialog(null,"删除成功");
                    }else JOptionPane.showMessageDialog(null,"删除失败");
                } catch (Exception ex) {
                    ex.printStackTrace();
                }finally {
                    DBConnection.close(null,ps,conn);
                }

            }
        }else{
            JOptionPane.showMessageDialog(null,
                    "您未选中任意一行!");
        }



 }
                //操作员设置事件按钮
 private void button3MouseClicked(MouseEvent e) {
     // TODO add your code here
     this.textField5.setVisible(false);
     this.scrollPane3.setVisible(false);
     this.table3.setVisible(false);
     this.textField6.setVisible(false);
        this.scrollPane1.setVisible(false);
        this.table1.setVisible(false);
        this.label1.setVisible(false);
        this.comboBox1.setVisible(false);
        this.textField1.setVisible(false);
        this.button5.setVisible(false);
        this.label4.setVisible(false);
        this.comboBox2.setVisible(false);
     this.scrollPane2.setVisible(false);
     this.table2.setVisible(false);
     this.scrollPane4.setVisible(true);
     this.table4.setVisible(true);
     this.textField9.setVisible(true);
     this.panel5.setVisible(true);
     this.button4.setVisible(false);
     this.button9.setVisible(true);
     this.button12.setVisible(true);
     this.button8.setVisible(false);
     this.button13.setVisible(false);





     Vector<Object> heads4=new Vector<Object>();
     heads4.add("管理员ID");
     heads4.add("管理员账户");
     heads4.add("管理员密码");
     heads4.add("管理员电话");

     //表数据
     Vector<Vector<Object>> data4= AdministratorController.getAll();

     //3、将表头和数据赋值给模型，表格模型构造完成
     DefaultTableModel dtm4=new DefaultTableModel(data4,heads4);
     table4.setModel(dtm4);
 }
                //修改折扣跳转按钮
 private void button4MouseClicked(MouseEvent e) {
     // TODO add your code here

     int index=table3.getSelectedRow();//选中行的索引
     if (index!=-1){//是否选中了一行
         //获取值 data、index
         //先传值
        label13.setText(data3.get(index).get(0).toString());
         textField15.setText(data3.get(index).get(1).toString());
         textField7.setText(data3.get(index).get(2).toString());

         //后展示对话框
         dialog2.setModal(true);
         dialog2.setVisible(true);
     }else{
         JOptionPane.showMessageDialog(null,
                 "您未选中任意一行!");
     }









 }




        //添加操做员
 private void button9MouseClicked(MouseEvent e) {
     // TODO add your code here
     dialog3.setModal(true);
     dialog3.setVisible(true);

 }
        //添加操作员的确认按钮
 private void button10MouseClicked(MouseEvent e) {
     // TODO add your code here

     Administrator s=new Administrator();
     s.setAdm_Accoount(textField12.getText());
     s.setAdm_Password(textField13.getText());
     s.setAdm_Phone(textField14.getText());



     if (!s.getAdm_Accoount().equals("") && !s.getAdm_Password().equals("")) {
         //唯一键重复
         data =AdministratorController.getAll();

         for (Vector<Object> item : data) {
             if (item.contains(s.getAdm_Accoount())) {
                 showdata();
                 JOptionPane.showMessageDialog(null,
                         "该管理员已存在!");
                 return;
             }
         }
         if (AdministratorController.register(s)) {

             JOptionPane.showMessageDialog(null,
                     "添加成功!");
             dialog3.dispose();//关闭对话框
         } else {
             JOptionPane.showMessageDialog(null,
                     "添加失败!");
         }
     } else {
         JOptionPane.showMessageDialog(null,
                 "账号或密码不能为空不能为空!");
     }

 }
    //操作员取消按钮
 private void button11MouseClicked(MouseEvent e) {
     // TODO add your code here
     textField12.setText("");
     textField13.setText("");
     textField14.setText("");
 }
        //删除操作员按钮
 private void button12MouseClicked(MouseEvent e) {
     // TODO add your code here

     int index=table4.getSelectedRow();//获取选择第一行的所索引
     if (index!=-1){//是否选中了一行
         if (JOptionPane.showConfirmDialog(null,
                 "您是否确认删除此数据?")==0){//是否点击了确定
             //取id   data、index  data是二维集合，第一个get获取了行、第二个get获取了列
             String sql="delete from administrator where Adm_ID=?";
             int id= (int) data.get(index).get(0);
             Connection conn=null;
             PreparedStatement ps=null;
             try {
                 conn=DBConnection.getConnection();
                 ps=conn.prepareStatement(sql);
                 ps.setInt(1,id);
                 if (ps.executeUpdate()>0){
                    showdata();
                     JOptionPane.showMessageDialog(null,"删除成功");
                 }else JOptionPane.showMessageDialog(null,"删除失败");
             } catch (Exception ex) {
                 ex.printStackTrace();
             }finally {
                 DBConnection.close(null,ps,conn);
             }

         }
     }else{
         JOptionPane.showMessageDialog(null,
                 "您未选中任意一行!");
     }
 }
        //房间类型修改按钮
 private void button13MouseClicked(MouseEvent e) {
     // TODO add your code here

     int index=table1.getSelectedRow();//选中行的索引
     if (index!=-1){//是否选中了一行
         //获取值 data、index
         //先传值
         label16.setText(data.get(index).get(0).toString());
         textField16.setText(data.get(index).get(1).toString());
         textField17.setText(data.get(index).get(2).toString());

         //后展示对话框
         dialog4.setModal(true);
         dialog4.setVisible(true);
     }else{
         JOptionPane.showMessageDialog(null,
                 "您未选中任意一行!");
     }


 }
        //房间类型确认按钮
 private void button14MouseClicked(MouseEvent e) {
     // TODO add your code here

     //1、获取数据
     Rooms_type ui=new Rooms_type();
     ui.setRooms_Type_ID(Integer.parseInt(label16.getText()));
     ui.setRoom_Type(textField16.getText());
     ui.setRoom_Price(Double.valueOf(textField17.getText()));

//     ui.setId(Integer.parseInt(label6.getText()));
//     ui.setUser(textField3.getText());
//     ui.setPwd(textField4.getText());
     //2、简单判断
     if (!ui.getRoom_Type().equals("") && !ui.getRoom_Price().equals("")){
         //唯一键重复
         for (Vector<Object> item:data){
             if(item.contains(ui.getRoom_Price())){
                 JOptionPane.showMessageDialog(null,
                         "该账号已存在!");
                 return;
             }
         }
         if (Rooms_typeController.edit(ui)){
             showdata();//自动刷新
             JOptionPane.showMessageDialog(null,
                     "更新成功!");
             dialog4.dispose();//关闭对话框
         }else{
             JOptionPane.showMessageDialog(null,
                     "更新失败!");
         }
     }else{
         JOptionPane.showMessageDialog(null,
                 "账号或密码不能为空!");
     }
 }
        //修改房间类型取消按钮
 private void button15MouseClicked(MouseEvent e) {
     // TODO add your code here
     textField16.setText("");
     textField17.setText("");
 }
    //折扣修改重置按钮
 private void button16MouseClicked(MouseEvent e) {
     // TODO add your code here
     textField15.setText("");
     textField7.setText("");
 }

 private void button17MouseClicked(MouseEvent e) {
     // TODO add your code here
     textField2.setText("");
     textField3.setText("");
     textField8.setText("");
     textField10.setText("");
     textField11.setText("");
 }




//



>>>>>>> 41a53c21de81f762a7a7e8110a6b6a114ea5d254


    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        panel1 = new JPanel();
        button1 = new JButton();
        button2 = new JButton();
        button3 = new JButton();
        label1 = new JLabel();
        comboBox1 = new JComboBox();
        panel2 = new JPanel();
        textField4 = new JTextField();
        scrollPane2 = new JScrollPane();
        table2 = new JTable();
        button5 = new JButton();
        button8 = new JButton();
        scrollPane1 = new JScrollPane();
        table1 = new JTable();
        label4 = new JLabel();
        comboBox2 = new JComboBox();
        textField5 = new JTextField();
        panel3 = new JPanel();
        scrollPane3 = new JScrollPane();
        table3 = new JTable();
        button4 = new JButton();
        textField6 = new JTextField();
        textField1 = new JTextField();
        textField9 = new JTextField();
        panel5 = new JPanel();
        scrollPane4 = new JScrollPane();
        table4 = new JTable();
        button9 = new JButton();
        button12 = new JButton();
        button13 = new JButton();
        dialog1 = new JDialog();
        label2 = new JLabel();
        textField2 = new JTextField();
        label3 = new JLabel();
        textField3 = new JTextField();
        button6 = new JButton();
        label6 = new JLabel();
        textField8 = new JTextField();
        label7 = new JLabel();
        label8 = new JLabel();
        textField10 = new JTextField();
        textField11 = new JTextField();
        button17 = new JButton();
        dialog2 = new JDialog();
        label5 = new JLabel();
        textField7 = new JTextField();
        button7 = new JButton();
        label12 = new JLabel();
        textField15 = new JTextField();
        label13 = new JLabel();
        button16 = new JButton();
        dialog3 = new JDialog();
        label9 = new JLabel();
        textField12 = new JTextField();
        label10 = new JLabel();
        textField13 = new JTextField();
        label11 = new JLabel();
        textField14 = new JTextField();
        button10 = new JButton();
        button11 = new JButton();
        dialog4 = new JDialog();
        label14 = new JLabel();
        textField16 = new JTextField();
        label15 = new JLabel();
        textField17 = new JTextField();
        button14 = new JButton();
        label16 = new JLabel();
        button15 = new JButton();

        //======== this ========
        Container contentPane = getContentPane();
        contentPane.setLayout(null);

        //======== panel1 ========
        {
            panel1.setLayout(null);

            //---- button1 ----
            button1.setText("\u623f\u95f4\u9879\u76ee\u8bbe\u7f6e");
            button1.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button1MouseClicked(e);
                }
            });
            panel1.add(button1);
            button1.setBounds(new Rectangle(new Point(75, 10), button1.getPreferredSize()));

            //---- button2 ----
            button2.setText("\u5ba2\u6237\u7c7b\u578b\u8bbe\u7f6e");
            button2.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button2MouseClicked(e);
                }
            });
            panel1.add(button2);
            button2.setBounds(new Rectangle(new Point(285, 10), button2.getPreferredSize()));

            //---- button3 ----
            button3.setText("\u64cd\u4f5c\u5458\u8bbe\u7f6e");
            button3.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button3MouseClicked(e);
                }
            });
            panel1.add(button3);
            button3.setBounds(485, 10, 130, button3.getPreferredSize().height);

            //---- label1 ----
            label1.setText("\u7ed3\u8d26\u540e\u72b6\u6001\uff1a");
            panel1.add(label1);
            label1.setBounds(5, 75, 170, label1.getPreferredSize().height);
            panel1.add(comboBox1);
            comboBox1.setBounds(150, 70, 155, comboBox1.getPreferredSize().height);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < panel1.getComponentCount(); i++) {
                    Rectangle bounds = panel1.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = panel1.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                panel1.setMinimumSize(preferredSize);
                panel1.setPreferredSize(preferredSize);
            }
        }
        contentPane.add(panel1);
        panel1.setBounds(65, 5, 745, 105);

        //======== panel2 ========
        {
            panel2.setLayout(new GridLayout());
            panel2.add(textField4);
        }
        contentPane.add(panel2);
        panel2.setBounds(185, 205, 1000, 0);

        //======== scrollPane2 ========
        {
            scrollPane2.setViewportView(table2);
        }
        contentPane.add(scrollPane2);
        scrollPane2.setBounds(115, 645, 940, 320);

        //---- button5 ----
        button5.setText("\u6dfb\u52a0\u623f\u95f4\u7c7b\u578b");
        button5.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                button5MouseClicked(e);
            }
        });
        contentPane.add(button5);
        button5.setBounds(65, 540, 195, button5.getPreferredSize().height);

        //---- button8 ----
        button8.setText("\u5220\u9664\u623f\u95f4\u7c7b\u578b");
        button8.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                button8MouseClicked(e);
            }
        });
        contentPane.add(button8);
        button8.setBounds(325, 540, 155, button8.getPreferredSize().height);

        //======== scrollPane1 ========
        {
            scrollPane1.setViewportView(table1);
        }
        contentPane.add(scrollPane1);
        scrollPane1.setBounds(55, 145, 960, 325);

        //---- label4 ----
        label4.setText("\u6309\u623f\u95f4\u7c7b\u578b");
        contentPane.add(label4);
        label4.setBounds(60, 605, 120, label4.getPreferredSize().height);
        contentPane.add(comboBox2);
        comboBox2.setBounds(260, 600, 235, comboBox2.getPreferredSize().height);

        //---- textField5 ----
        textField5.setText("\u5ba2\u6237\u7c7b\u578b\uff1a");
        contentPane.add(textField5);
        textField5.setBounds(65, 110, 125, 30);

        //======== panel3 ========
        {
            panel3.setVisible(false);
            panel3.setLayout(null);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < panel3.getComponentCount(); i++) {
                    Rectangle bounds = panel3.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = panel3.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                panel3.setMinimumSize(preferredSize);
                panel3.setPreferredSize(preferredSize);
            }
        }
        contentPane.add(panel3);
        panel3.setBounds(130, 225, 473, panel3.getPreferredSize().height);

        //======== scrollPane3 ========
        {
            scrollPane3.setViewportView(table3);
        }
        contentPane.add(scrollPane3);
        scrollPane3.setBounds(55, 145, 960, 325);

        //---- button4 ----
        button4.setText("\u4fee\u6539\u6298\u6263");
        button4.setVisible(false);
        button4.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                button4MouseClicked(e);
            }
        });
        contentPane.add(button4);
        button4.setBounds(70, 505, 140, button4.getPreferredSize().height);

        //---- textField6 ----
        textField6.setText("\u623f\u95f4\u8d39\u6253\u6298\uff1a");
        textField6.setVisible(false);
        contentPane.add(textField6);
        textField6.setBounds(95, 600, 120, textField6.getPreferredSize().height);

        //---- textField1 ----
        textField1.setText("\u623f\u95f4\u7c7b\u578b\uff1a");
        contentPane.add(textField1);
        textField1.setBounds(63, 112, 130, 30);

        //---- textField9 ----
        textField9.setText("\u64cd\u4f5c\u5458\u5217\u8868");
        contentPane.add(textField9);
        textField9.setBounds(63, 112, 130, textField9.getPreferredSize().height);

        //======== panel5 ========
        {
            panel5.setLayout(null);

            //======== scrollPane4 ========
            {
                scrollPane4.setViewportView(table4);
            }
            panel5.add(scrollPane4);
            scrollPane4.setBounds(5, 5, 780, 270);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < panel5.getComponentCount(); i++) {
                    Rectangle bounds = panel5.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = panel5.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                panel5.setMinimumSize(preferredSize);
                panel5.setPreferredSize(preferredSize);
            }
        }
        contentPane.add(panel5);
        panel5.setBounds(new Rectangle(new Point(215, 190), panel5.getPreferredSize()));

        //---- button9 ----
        button9.setText("\u6dfb\u52a0\u64cd\u505a\u5458");
        button9.setVisible(false);
        button9.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                button9MouseClicked(e);
            }
        });
        contentPane.add(button9);
        button9.setBounds(240, 505, 150, 35);

        //---- button12 ----
        button12.setText("\u5220\u9664\u64cd\u4f5c\u5458");
        button12.setVisible(false);
        button12.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                button12MouseClicked(e);
            }
        });
        contentPane.add(button12);
        button12.setBounds(420, 505, 140, 35);

        //---- button13 ----
        button13.setText("\u4fee\u6539\u623f\u95f4\u7c7b\u578b");
        button13.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                button13MouseClicked(e);
            }
        });
        contentPane.add(button13);
        button13.setBounds(550, 540, 190, button13.getPreferredSize().height);

        {
            // compute preferred size
            Dimension preferredSize = new Dimension();
            for(int i = 0; i < contentPane.getComponentCount(); i++) {
                Rectangle bounds = contentPane.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = contentPane.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            contentPane.setMinimumSize(preferredSize);
            contentPane.setPreferredSize(preferredSize);
        }
        pack();
        setLocationRelativeTo(getOwner());

        //======== dialog1 ========
        {
            Container dialog1ContentPane = dialog1.getContentPane();
            dialog1ContentPane.setLayout(null);

            //---- label2 ----
            label2.setText("\u623f\u95f4\u7c7b\u578b\uff1a");
            dialog1ContentPane.add(label2);
            label2.setBounds(15, 20, 110, 35);
            dialog1ContentPane.add(textField2);
            textField2.setBounds(170, 15, 130, 30);

            //---- label3 ----
            label3.setText("\u623f\u95f4\u4ef7\u683c\uff1a");
            dialog1ContentPane.add(label3);
            label3.setBounds(15, 65, 110, 35);
            dialog1ContentPane.add(textField3);
            textField3.setBounds(170, 65, 130, 30);

            //---- button6 ----
            button6.setText("\u786e\u5b9a");
            button6.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button6MouseClicked(e);
                }
            });
            dialog1ContentPane.add(button6);
            button6.setBounds(55, 330, 78, 40);

            //---- label6 ----
            label6.setText("\u623f\u95f4\u56fe\u7247\uff1a");
            dialog1ContentPane.add(label6);
            label6.setBounds(15, 130, 110, 35);
            dialog1ContentPane.add(textField8);
            textField8.setBounds(170, 130, 130, 30);

            //---- label7 ----
            label7.setText("\u623f\u95f4\u7b49\u7ea7ID\uff1a");
            dialog1ContentPane.add(label7);
            label7.setBounds(15, 185, 85, 25);

            //---- label8 ----
            label8.setText("\u623f\u95f4\u7b80\u4ecb\uff1a");
            dialog1ContentPane.add(label8);
            label8.setBounds(15, 240, 65, 30);
            dialog1ContentPane.add(textField10);
            textField10.setBounds(170, 185, 130, textField10.getPreferredSize().height);
            dialog1ContentPane.add(textField11);
            textField11.setBounds(170, 245, 130, 30);

            //---- button17 ----
            button17.setText("\u91cd\u7f6e");
            button17.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button17MouseClicked(e);
                }
            });
            dialog1ContentPane.add(button17);
            button17.setBounds(235, 330, 88, 40);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < dialog1ContentPane.getComponentCount(); i++) {
                    Rectangle bounds = dialog1ContentPane.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = dialog1ContentPane.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                dialog1ContentPane.setMinimumSize(preferredSize);
                dialog1ContentPane.setPreferredSize(preferredSize);
            }
            dialog1.pack();
            dialog1.setLocationRelativeTo(dialog1.getOwner());
        }

        //======== dialog2 ========
        {
            Container dialog2ContentPane = dialog2.getContentPane();
            dialog2ContentPane.setLayout(null);

            //---- label5 ----
            label5.setText("VIP\u6298\u6263\uff1a");
            dialog2ContentPane.add(label5);
            label5.setBounds(15, 145, 110, 30);
            dialog2ContentPane.add(textField7);
            textField7.setBounds(175, 150, 120, 30);

            //---- button7 ----
            button7.setText("\u786e\u5b9a");
            button7.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button7MouseClicked(e);
                }
            });
            dialog2ContentPane.add(button7);
            button7.setBounds(55, 205, 95, 50);

            //---- label12 ----
            label12.setText("\u4f1a\u5458\u7c7b\u578b\uff1a");
            dialog2ContentPane.add(label12);
            label12.setBounds(15, 90, 135, 40);
            dialog2ContentPane.add(textField15);
            textField15.setBounds(175, 100, 120, 30);

            //---- label13 ----
            label13.setText("\u4f1a\u5458ID\uff1a");
            dialog2ContentPane.add(label13);
            label13.setBounds(15, 40, 70, 40);

            //---- button16 ----
            button16.setText("\u91cd\u7f6e");
            button16.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button16MouseClicked(e);
                }
            });
            dialog2ContentPane.add(button16);
            button16.setBounds(205, 205, 95, 45);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < dialog2ContentPane.getComponentCount(); i++) {
                    Rectangle bounds = dialog2ContentPane.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = dialog2ContentPane.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                dialog2ContentPane.setMinimumSize(preferredSize);
                dialog2ContentPane.setPreferredSize(preferredSize);
            }
            dialog2.pack();
            dialog2.setLocationRelativeTo(dialog2.getOwner());
        }

        //======== dialog3 ========
        {
            Container dialog3ContentPane = dialog3.getContentPane();
            dialog3ContentPane.setLayout(null);

            //---- label9 ----
            label9.setText("\u8d26\u6237\uff1a");
            dialog3ContentPane.add(label9);
            label9.setBounds(30, 35, 80, 35);
            dialog3ContentPane.add(textField12);
            textField12.setBounds(155, 40, 160, textField12.getPreferredSize().height);

            //---- label10 ----
            label10.setText("\u5bc6\u7801\uff1a");
            dialog3ContentPane.add(label10);
            label10.setBounds(30, 105, 80, 35);
            dialog3ContentPane.add(textField13);
            textField13.setBounds(155, 110, 160, textField13.getPreferredSize().height);

            //---- label11 ----
            label11.setText("\u7535\u8bdd\uff1a");
            dialog3ContentPane.add(label11);
            label11.setBounds(30, 165, 80, 35);
            dialog3ContentPane.add(textField14);
            textField14.setBounds(155, 170, 160, textField14.getPreferredSize().height);

            //---- button10 ----
            button10.setText("\u786e\u5b9a");
            button10.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button10MouseClicked(e);
                }
            });
            dialog3ContentPane.add(button10);
            button10.setBounds(40, 245, 110, 35);

            //---- button11 ----
            button11.setText("\u91cd\u7f6e");
            button11.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button11MouseClicked(e);
                }
            });
            dialog3ContentPane.add(button11);
            button11.setBounds(205, 245, 110, 35);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < dialog3ContentPane.getComponentCount(); i++) {
                    Rectangle bounds = dialog3ContentPane.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = dialog3ContentPane.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                dialog3ContentPane.setMinimumSize(preferredSize);
                dialog3ContentPane.setPreferredSize(preferredSize);
            }
            dialog3.pack();
            dialog3.setLocationRelativeTo(dialog3.getOwner());
        }

        //======== dialog4 ========
        {
            Container dialog4ContentPane = dialog4.getContentPane();
            dialog4ContentPane.setLayout(null);

            //---- label14 ----
            label14.setText("\u623f\u95f4\u7c7b\u578b\uff1a");
            dialog4ContentPane.add(label14);
            label14.setBounds(45, 80, 120, 35);
            dialog4ContentPane.add(textField16);
            textField16.setBounds(200, 80, 130, 30);

            //---- label15 ----
            label15.setText("\u623f\u95f4\u4ef7\u683c\uff1a");
            dialog4ContentPane.add(label15);
            label15.setBounds(45, 160, 120, 35);
            dialog4ContentPane.add(textField17);
            textField17.setBounds(200, 165, 130, 30);

            //---- button14 ----
            button14.setText("\u786e\u5b9a");
            button14.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button14MouseClicked(e);
                }
            });
            dialog4ContentPane.add(button14);
            button14.setBounds(50, 290, 130, 45);

            //---- label16 ----
            label16.setText("\u623f\u95f4\u7c7b\u578bID");
            dialog4ContentPane.add(label16);
            label16.setBounds(45, 20, 120, 35);

            //---- button15 ----
            button15.setText("\u91cd\u7f6e");
            button15.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    button15MouseClicked(e);
                }
            });
            dialog4ContentPane.add(button15);
            button15.setBounds(205, 290, 130, 45);

            {
                // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < dialog4ContentPane.getComponentCount(); i++) {
                    Rectangle bounds = dialog4ContentPane.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = dialog4ContentPane.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                dialog4ContentPane.setMinimumSize(preferredSize);
                dialog4ContentPane.setPreferredSize(preferredSize);
            }
            dialog4.pack();
            dialog4.setLocationRelativeTo(dialog4.getOwner());
        }
        // JFormDesigner - End of component initialization  //GEN-END:initComponents

<<<<<<< HEAD
        comboBox1.addItem("未入住");
        comboBox1.addItem("已入住");
        comboBox1.addItem("已预定");
        comboBox2.addItem("全部房间信息");
        comboBox2.addItem("单人间");
        comboBox2.addItem("双人间");
        comboBox2.addItem("商务间");
        comboBox2.addItem("总统房");
        comboBox2.addItem("豪华单人间");
        comboBox2.addItem("豪华双人间");






        //表一
        //表头
        Vector<Object> heads=new Vector<Object>();
        heads.add("房间类型编号");
        heads.add("房间类型");
        heads.add("房间价格");

        //表数据
        Vector<Vector<Object>> data= Rooms_typeController.getAll();

        //3、将表头和数据赋值给模型，表格模型构造完成
        DefaultTableModel dtm=new DefaultTableModel(data,heads);
        table1.setModel(dtm);
=======
>>>>>>> 41a53c21de81f762a7a7e8110a6b6a114ea5d254

        showdata();

    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    private JPanel panel1;
    private JButton button1;
    private JButton button2;
    private JButton button3;
    private JLabel label1;
    private JComboBox comboBox1;
    private JPanel panel2;
    private JTextField textField4;
    private JScrollPane scrollPane2;
    private JTable table2;
    private JButton button5;
    private JButton button8;
    private JScrollPane scrollPane1;
    private JTable table1;
    private JLabel label4;
    private JComboBox comboBox2;
    private JTextField textField5;
    private JPanel panel3;
    private JScrollPane scrollPane3;
    private JTable table3;
    private JButton button4;
    private JTextField textField6;
    private JTextField textField1;
    private JTextField textField9;
    private JPanel panel5;
    private JScrollPane scrollPane4;
    private JTable table4;
    private JButton button9;
    private JButton button12;
    private JButton button13;
    private JDialog dialog1;
    private JLabel label2;
    private JTextField textField2;
    private JLabel label3;
    private JTextField textField3;
    private JButton button6;
    private JLabel label6;
    private JTextField textField8;
    private JLabel label7;
    private JLabel label8;
    private JTextField textField10;
    private JTextField textField11;
    private JButton button17;
    private JDialog dialog2;
    private JLabel label5;
    private JTextField textField7;
    private JButton button7;
    private JLabel label12;
    private JTextField textField15;
    private JLabel label13;
    private JButton button16;
    private JDialog dialog3;
    private JLabel label9;
    private JTextField textField12;
    private JLabel label10;
    private JTextField textField13;
    private JLabel label11;
    private JTextField textField14;
    private JButton button10;
    private JButton button11;
    private JDialog dialog4;
    private JLabel label14;
    private JTextField textField16;
    private JLabel label15;
    private JTextField textField17;
    private JButton button14;
    private JLabel label16;
    private JButton button15;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
    private  Vector<Vector<Object>> data;
    Vector<Vector<Object>> data3;
}
